CC = g++
CFLAGS = -Wall -O3 -std=c++17 -I./include -I./gen -I./cppitertools -DLOG_USE_COLOR

mjlib: src/mj_tiles.cc \
	src/xueliuhz/card.cc src/xueliuhz/fan.cc \
	src/xueliuhz/fan_data.cc src/hash_lookup3.cc \
	src/log.cc
	$(CC) $(CFLAGS) -c $^
	ar cr libmjhu.a *.o
	rm -f *.o

mjsvr: src/server_udp.cc src/mj_cache.cc libmjhu.a
	$(CC)  -o $@ $^ $(CFLAGS)  -L./ -L./gen libmjhu.a -lmj -lpthread -lz
mjcli: src/client_udp.cc libmjhu.a
	$(CC)  -o $@ $^ $(CFLAGS)  -L./ -L./gen libmjhu.a -lmj -lpthread -lz
tile: src/mj_test.cc libmjhu.a
	$(CC)  -o $@ $^ $(CFLAGS)  -L./ -L./gen libmjhu.a -lmj -lpthread -lz
clean:
	rm -f mjsvr mjcli tile libmjhu.a
